DevForce Help Reference
And<T>(Expression<Func<T,Boolean>>[]) Method
Example 


Expressions to be AND'ed
Returns an expression which represents a conditional AND operation of the specified operands.
Syntax
'Declaration
 
Public Overloads Shared Function And(Of T)( _
   ByVal ParamArray expressions() As Expression(Of Func(Of T,Boolean)) _
) As Expression(Of Func(Of T,Boolean))
'Usage
 
Dim expressions() As Expression(Of Func(Of T,Boolean))
Dim value As Expression(Of Func(Of T,Boolean))
 
value = PredicateBuilder.And(Of T)(expressions)

Parameters

expressions
Expressions to be AND'ed

Type Parameters

T
Remarks
The resulting expression is an "AndAlso" binary expression of all operands provided.
Example
public void AndQuery() {
  var mgr = new DomainModelEntityManager();
  Expression<Func<Customer, bool>> crit1 = c => c.Country.Equals("Mexico");
  Expression<Func<Customer, bool>> crit2 = c => c.CompanyName.StartsWith("A");
  Expression<Func<Customer, bool>> crit3 = c => c.City.StartsWith("M");

  // 'and' all criteria.
  var finalcrit = PredicateBuilder.And(crit1, crit2, crit3);
  var results = mgr.Customers.Where(finalcrit).ToList();
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PredicateBuilder Class
PredicateBuilder Members
Overload List

Send Feedback